package recharge_management

import (
	"context"

	"gitee.com/liuxuezhan/ar-platform/rpc-client/assetsClient/rpc"

	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/svc"
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type BankDailyLimitInfoLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

// bank日总限额--查询
func NewBankDailyLimitInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *BankDailyLimitInfoLogic {
	return &BankDailyLimitInfoLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *BankDailyLimitInfoLogic) BankDailyLimitInfo() (resp *types.DailyLimitInfoResponse, err error) {
	rpcReq := rpc.DailyLimitInfoRequest{}

	rpcResp, err := l.svcCtx.AssetsRpc.TenantChannel.BankDailyLimitInfo(l.ctx, &rpcReq)
	if err != nil {
		return nil, err
	}

	return &types.DailyLimitInfoResponse{
		IsLimit: rpcResp.IsLimit,
		CommonResp: types.CommonResp{
			Code:    0,
			Message: "Success",
		},
	}, nil
}
